3.2 \(\int (a+b \tan (c+d x)) (B \tan (c+d x)+C \tan ^2(c+d x)) \, dx\)

Optimal. Leaf size=66 \[ -\frac{(a B-b C) \log (\cos (c+d x))}{d}-x (a C+b B)+\frac{C (a+b \tan (c+d x))^2}{2 b d}+\frac{b B \tan (c+d x)}{d} \]

[Out]

-((b*B + a*C)*x) - ((a*B - b*C)*Log[Cos[c + d*x]])/d + (b*B*Tan[c + d*x])/d + (C*(a + b*Tan[c + d*x])^2)/(2*b*
d)

________________________________________________________________________________________

Rubi [A]  time = 0.0458897, antiderivative size = 66, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 30, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.1, Rules used = {3630, 3525, 3475} \[ -\frac{(a B-b C) \log (\cos (c+d x))}{d}-x (a C+b B)+\frac{C (a+b \tan (c+d x))^2}{2 b d}+\frac{b B \tan (c+d x)}{d} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Tan[c + d*x])*(B*Tan[c + d*x] + C*Tan[c + d*x]^2),x]

[Out]

-((b*B + a*C)*x) - ((a*B - b*C)*Log[Cos[c + d*x]])/d + (b*B*Tan[c + d*x])/d + (C*(a + b*Tan[c + d*x])^2)/(2*b*
d)

Rule 3630

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (
f_.)*(x_)]^2), x_Symbol] :> Simp[(C*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e + f*x])
^m*Simp[A - C + B*Tan[e + f*x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && NeQ[A*b^2 - a*b*B + a^2*C, 0]
&&  !LeQ[m, -1]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx &=\frac{C (a+b \tan (c+d x))^2}{2 b d}+\int (a+b \tan (c+d x)) (-C+B \tan (c+d x)) \, dx\\ &=-(b B+a C) x+\frac{b B \tan (c+d x)}{d}+\frac{C (a+b \tan (c+d x))^2}{2 b d}+(a B-b C) \int \tan (c+d x) \, dx\\ &=-(b B+a C) x-\frac{(a B-b C) \log (\cos (c+d x))}{d}+\frac{b B \tan (c+d x)}{d}+\frac{C (a+b \tan (c+d x))^2}{2 b d}\\ \end{align*}

Mathematica [A]  time = 0.292894, size = 67, normalized size = 1.02 \[ \frac{-2 (a C+b B) \tan ^{-1}(\tan (c+d x))+2 (a C+b B) \tan (c+d x)+2 (b C-a B) \log (\cos (c+d x))+b C \tan ^2(c+d x)}{2 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Tan[c + d*x])*(B*Tan[c + d*x] + C*Tan[c + d*x]^2),x]

[Out]

(-2*(b*B + a*C)*ArcTan[Tan[c + d*x]] + 2*(-(a*B) + b*C)*Log[Cos[c + d*x]] + 2*(b*B + a*C)*Tan[c + d*x] + b*C*T
an[c + d*x]^2)/(2*d)

________________________________________________________________________________________

Maple [A]  time = 0.013, size = 105, normalized size = 1.6 \begin{align*}{\frac{C \left ( \tan \left ( dx+c \right ) \right ) ^{2}b}{2\,d}}+{\frac{B\tan \left ( dx+c \right ) b}{d}}+{\frac{C\tan \left ( dx+c \right ) a}{d}}+{\frac{a\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) B}{2\,d}}-{\frac{\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) Cb}{2\,d}}-{\frac{B\arctan \left ( \tan \left ( dx+c \right ) \right ) b}{d}}-{\frac{C\arctan \left ( \tan \left ( dx+c \right ) \right ) a}{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x)

[Out]

1/2/d*C*b*tan(d*x+c)^2+b*B*tan(d*x+c)/d+1/d*C*tan(d*x+c)*a+1/2/d*a*ln(1+tan(d*x+c)^2)*B-1/2/d*ln(1+tan(d*x+c)^
2)*C*b-1/d*B*arctan(tan(d*x+c))*b-1/d*C*arctan(tan(d*x+c))*a

________________________________________________________________________________________

Maxima [A]  time = 1.76493, size = 89, normalized size = 1.35 \begin{align*} \frac{C b \tan \left (d x + c\right )^{2} - 2 \,{\left (C a + B b\right )}{\left (d x + c\right )} +{\left (B a - C b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \,{\left (C a + B b\right )} \tan \left (d x + c\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, algorithm="maxima")

[Out]

1/2*(C*b*tan(d*x + c)^2 - 2*(C*a + B*b)*(d*x + c) + (B*a - C*b)*log(tan(d*x + c)^2 + 1) + 2*(C*a + B*b)*tan(d*
x + c))/d

________________________________________________________________________________________

Fricas [A]  time = 1.43942, size = 161, normalized size = 2.44 \begin{align*} \frac{C b \tan \left (d x + c\right )^{2} - 2 \,{\left (C a + B b\right )} d x -{\left (B a - C b\right )} \log \left (\frac{1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 2 \,{\left (C a + B b\right )} \tan \left (d x + c\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, algorithm="fricas")

[Out]

1/2*(C*b*tan(d*x + c)^2 - 2*(C*a + B*b)*d*x - (B*a - C*b)*log(1/(tan(d*x + c)^2 + 1)) + 2*(C*a + B*b)*tan(d*x
+ c))/d

________________________________________________________________________________________

Sympy [A]  time = 0.587673, size = 105, normalized size = 1.59 \begin{align*} \begin{cases} \frac{B a \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - B b x + \frac{B b \tan{\left (c + d x \right )}}{d} - C a x + \frac{C a \tan{\left (c + d x \right )}}{d} - \frac{C b \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac{C b \tan ^{2}{\left (c + d x \right )}}{2 d} & \text{for}\: d \neq 0 \\x \left (a + b \tan{\left (c \right )}\right ) \left (B \tan{\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)**2),x)

[Out]

Piecewise((B*a*log(tan(c + d*x)**2 + 1)/(2*d) - B*b*x + B*b*tan(c + d*x)/d - C*a*x + C*a*tan(c + d*x)/d - C*b*
log(tan(c + d*x)**2 + 1)/(2*d) + C*b*tan(c + d*x)**2/(2*d), Ne(d, 0)), (x*(a + b*tan(c))*(B*tan(c) + C*tan(c)*
*2), True))

________________________________________________________________________________________

Giac [B]  time = 1.92277, size = 832, normalized size = 12.61 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, algorithm="giac")

[Out]

-1/2*(2*C*a*d*x*tan(d*x)^2*tan(c)^2 + 2*B*b*d*x*tan(d*x)^2*tan(c)^2 + B*a*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan
(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)^2*tan(c)^2 -
 C*b*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*ta
n(d*x)*tan(c) + 1))*tan(d*x)^2*tan(c)^2 - 4*C*a*d*x*tan(d*x)*tan(c) - 4*B*b*d*x*tan(d*x)*tan(c) - C*b*tan(d*x)
^2*tan(c)^2 - 2*B*a*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + ta
n(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)*tan(c) + 2*C*b*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d
*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)*tan(c) + 2*C*a*tan(d*x)^2*t
an(c) + 2*B*b*tan(d*x)^2*tan(c) + 2*C*a*tan(d*x)*tan(c)^2 + 2*B*b*tan(d*x)*tan(c)^2 + 2*C*a*d*x + 2*B*b*d*x -
C*b*tan(d*x)^2 - C*b*tan(c)^2 + B*a*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)
^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)) - C*b*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x
)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)) - 2*C*a*tan(d*x) - 2*B*b*tan(d*x) - 2*
C*a*tan(c) - 2*B*b*tan(c) - C*b)/(d*tan(d*x)^2*tan(c)^2 - 2*d*tan(d*x)*tan(c) + d)